﻿using Abp.Domain.Entities;
using DHJ.Cost.Tasks;
using DHJ.Cost.Timing;
using DHJ.Cost.Workshops;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DHJ.Cost.ManHours
{
    public class BatchManHour : AggregateRoot
    {
        private BatchManHour() { }

        public BatchManHour(OccurrenceTime time, Workshop workshop, string batchId, int quantity, ManHour hours)
        {
            Time = time;
            Workshop = workshop;
            BatchId = batchId;
            Quantity = quantity;
            Hours = hours;
        }

        [Required]
        public OccurrenceTime Time { get; private set; }

        [Required]
        public Workshop Workshop { get; private set; }

        [Required]
        public string BatchId { get; private set; }

        [ForeignKey(nameof(BatchId))]
        public Batch Batch { get; set; }

        public int Quantity { get; private set; }

        [Required]
        public ManHour Hours { get; private set; }

        public string Facility { get; set; }
    }
}